﻿


///////////////////////////////评论///////////////////////////////


function comment(listname_id,type){
	var content = $("#content").val();
	document.getElementById("content").value="";
 	$.ajax({
		url:"../music/comment.php",
		data:"listname_id="+listname_id+"&content="+content+"&type="+type,
		type:"POST",
		dataType:"text",
		success :function(date){

			 $(".message_show").prepend(rethml)
		
				function rethml(){
				var str=date;
				return str; 
			} 
		},
		error:function(){
		alert("dsfdsf");
		}
	
	
	}); 

}
function ShowAreadyVote(){
		var WinWidth=$(document.body).width();
		var WinHeight=$(document.body).height();
		var leftw=WinWidth*0.3+"px";
		var topw=WinHeight*0.5+"px";
		alert(leftw);
		$(".already_vote").css({"left":leftw,"top":topw})
		$(".already_vote").fadeIn(100);
		setTimeout(function(){

		$(".already_vote").fadeOut(100);

		},1000)


}
/* 投票 */
function vote(a,vote_id,list_name_id,ranking,offic_or_user){

$.ajax({
type:"POST",
url:"../music/vote.php",
dataType:"text",
data: "vote_id="+vote_id+"&list_name_id="+list_name_id+"&ranking="+ranking+"&offic_or_user="+offic_or_user,
success:function(date){
var re=date.replace(/(^\s*)|(\s*$)/g, "");//正则去空格

	if(re=="er"){
		ShowAreadyVote();
	}else{
		if(a==0){
		/* 投票量 */
			$vote=Number($("#vote").html())+1;
			$("#vote").text($vote);
			
			var span_id="\#"+"v"+(vote_id+100);
			$(span_id).html(date);
			 var ding_img="\#"+"d"+(vote_id+100);
			$(ding_img).removeClass("support_after").addClass("support");//顶变换ID */
		}else{
		/* 投票量 */
		$vote=Number($("#vote").html())+1;
		$("#vote").text($vote);
		
			var span_id="\#"+"s"+(vote_id+100);
			$(span_id).html(date);
			 var ding_img="\#"+"c"+(vote_id+100);
			$(ding_img).removeClass("hate_after").addClass("hate");//踩变换id */
		}
	}
}




}); 



}

function content_fenye(page,type,pagenum,listname_id,a,b){
$.ajax({
type:"POST",
url:"../music/MusicAjaxFenye.php",
dataType:"text",
data: "page="+page+"&listname_id="+listname_id+"&type="+type+"&pagenum="+pagenum,
success:function(date){
$(".content_list").html(date);

}



});

}
function comment_fenye(page_comment,type,pagenum_comment,listname_id,a,b){
$.ajax({
type:"POST",
url:"../music/MusicCommentFenye.php",
dataType:"text",
data: "page_comment="+page_comment+"&listname_id="+listname_id+"&type="+type+"&pagenum_comment="+pagenum_comment,
success:function(date){
$(".message_show").html(date);

}



});

}








